﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>哪都通</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-control" content="no-cache" />
    <meta http-equiv="Cache" content="no-cache" />
    <link href="/manage/layuiadmin/layui/css/layui.css" rel="stylesheet" />
    <link href="/manage/assets/css/links2.css" rel="stylesheet" />
    <script src="/manage/layuiadmin/layui/layui.js"></script>
</head>
<body>

    <div class="tool-header content-body-minwidth">
        <div class="tool-header-content">
            <span id="soul" class="chickensoup xhide"></span>
            <span id="days" class="chickensoup xhide"></span>
            <!--<a target="_blank" href="http://img.xuchanglong.cn/support.png" class="fr tool-ml20 xhide">💰 买不起奶粉</a> -->
            <!--<a target="_blank" href="/linkold.html" class="fr tool-ml20 xhide">🍊 怀旧</a>-->
            <a target="_blank" href="https://layui.gitee.io/v2" class="fr tool-ml20 xhide">🔥 layui 镜像</a>
            <!--<a target="_blank" href="http://devops.xuchanglong.cn/manage/views/UpdateLog/release.html" class="fr tool-ml20 xhide">📝 检后升级记录</a>-->
            <!--<a target="_blank" href="https://support.qq.com/products/377348" class="fr tool-ml20 xhide">🤣 我要吐槽</a>-->
            <a target="_blank" href="https://yilijie.yuque.com/docs/share/4615ecda-39c3-42e6-b97e-0538437cc20e" class="fr tool-ml20  xhide">🔗 公众号</a>
            <input type="text" name="title" id="btn_filter" tabindex="0" lay-verify="title" autocomplete="off" placeholder="搜索(Enter)" class="layui-input fr btn_filter" onkeyup="filter(this)" />
        </div>
    </div>

    <div class="layui-tab-content content-body">

        <fieldset class="layui-elem-field layui-field-title color fieldsethide"><legend>健康管理</legend></fieldset>
        <div class="layui-tab-item layui-show" id="prod"></div>

        <fieldset class="layui-elem-field layui-field-title color fieldsethide"><legend>开发&测试</legend></fieldset>
        <div class="layui-tab-item layui-show" id="dev"></div>

    </div>

    <div class="tool-foot content-body-minwidth tool-foot-content">
        Copyright © 徐昌龙 &nbsp;&nbsp; <a target="_blank" href="https://beian.miit.gov.cn"> 鲁ICP备2020046361号 </a>
    </div>

    <div class="admin-form-container" id="J_editAlert" style="display: none;">
        <div>
            <video style="width:400px;height:600px" id="video_mp4" controls="controls" autoplay></video>
        </div>
    </div>

    <script src="/manage/assets/js/jquery.min.js"></script>
    <script src="manage/config/config.js"></script>
    <script src="hospitaData.js"></script>
    <script src="/manage/assets/js/tinylog.js"></script>
    <script>
        var linkData;
        layui.use(['util', 'jquery', 'layer', 'element'], function () {
            var element = layui.element;
            var util = layui.util;

            // 固定块
            util.fixbar({
                bar1: false
                , bar2: false
                , css: { right: 30, bottom: 80 }
                //, bgcolor: '#16a951'
                , click: function (type) {
                    if (type === 'bar1') {
                        layer.msg('icon 是可以随便换的')
                    } else if (type === 'bar2') {
                        layer.msg('两个 bar 都可以设定是否开启')
                    }
                }
            });

            document.getElementById("btn_filter").focus();

            $(document).keypress(function (e) {
                if (e.keyCode == 13) {
                    document.getElementById("btn_filter").focus();
                }
            });

            linkData = hospitaData;
            var tempData = hospitaData;
            var prodArr = [];
            var devArr = [];
            var testArr = [];
            for (var i in tempData) {
                if (tempData[i].environmentType == 3) { prodArr.push(tempData[i]); }
                if (tempData[i].environmentType == 1) { devArr.push(tempData[i]); }
                if (tempData[i].environmentType == 2) { testArr.push(tempData[i]); }
            }
            $('#prod').empty().append(assembleHtml(prodArr));
            $('#dev').empty().append(assembleHtml(devArr));

            $('fieldset').removeClass('fieldsethide');
            $('img').error(function () { $(this).attr('src', "http://img.xuchanglong.cn/favicon.ico"); });

            getJT();
        });

        function assembleHtml(tempData) {
            var tabHtml = '<div class="tool-content">';
            tabHtml += '<ul class="tool-box">';
            for (var i in tempData) {
                tabHtml += '<li><div>';
                tabHtml += '<img src="' + tempData[i].logoImg + '" alt="logo" title="' + tempData[i].fullName + '">';
                tabHtml += '<strong>' + tempData[i].shortName + '</strong>';
                tabHtml += '<span class="tool-hits fr version">&nbsp;v' + tempData[i].version + '</span>';
                tabHtml += '</div><div>';
                tabHtml += '<a hospitalCode="' + tempData[i].code + '" href="' + tempData[i].weChatUrl + '" target="_blank"><i class="layui-icon">&#xe677;</i> 微信</a>';
                tabHtml += '<a hospitalCode="' + tempData[i].code + '" href="' + tempData[i].pcUrl + '" target="_blank"><i class="layui-icon">&#xe7ae;</i> 网站</a>';
                tabHtml += '<a hospitalCode="' + tempData[i].code + '" href="' + tempData[i].manageUrl + '" target="_blank"><i class="layui-icon">&#xe614;</i> 管理</a>';
                tabHtml += '</div></li>';
            }
            tabHtml += '</ul>';
            tabHtml += '</div>';

            return tabHtml;
        }

        function assembleWeChat(tempData) {
            var tabHtml = '<div class="tool-weChat">';
            tabHtml += '<ul class="tool-box">';
            for (var i in tempData) {
                tabHtml += '<li>';
                tabHtml += '<strong>' + tempData[i].shortName + '</strong>';
                tabHtml += '<img src="' + tempData[i].weChatPic + '" alt="' + tempData[i].name + '" />';
                tabHtml += '</li>';
            }
            tabHtml += '</ul>';
            tabHtml += '</div>';
            return tabHtml;
        }

        $('#weChat').on('click', 'ul > li > img', function (event) {
            event.stopPropagation();
            console.log($(this).prop("outerHTML"));

            layer.open({
                type: 1,
                skin: 'layui-layer-rim',
                shadeClose: true,
                area: ['420px', '445px'],
                title: $(this).prev().text() + '-二维码',
                content: '<div class="weChat-img-max">' + $(this).prop("outerHTML") + '</div>'
            });
        });

        $('#soul').on('click', function () { getJT(); });

        function getJT() {
            //$.getJSON("https://api.oick.cn/dutang/api.php", function (data) { $('#soul').text(data); });
            //$.getJSON("https://api.lovelive.tools/api/SweetNothings", function (data) { $('#soul').text(data); });
            $.getJSON("https://api.apiopen.top/api/sentences", function (data) { $('#soul').text(data.result.name); });
        }

        function filter(obj) {
            var keyWord = $('#btn_filter').val();

            var tempData = linkData;
            var prodArr = [];
            var devArr = [];

            if (keyWord != '') {
                for (var i in tempData) {
                    if (tempData[i].shortName.split(keyWord).length > 1) {
                        if (tempData[i].environmentType == 3) { prodArr.push(tempData[i]); }
                        if (tempData[i].environmentType == 1 || tempData[i].environmentType == 2) { devArr.push(tempData[i]); }
                    }
                }
                $('fieldset').addClass('fieldsethide');
            } else {
                for (var i in tempData) {
                    if (tempData[i].environmentType == 3) { prodArr.push(tempData[i]); }
                    if (tempData[i].environmentType == 1 || tempData[i].environmentType == 2) { devArr.push(tempData[i]); }
                }
                $('fieldset').removeClass('fieldsethide');
            }

            //if (prodArr.length == 0 && devArr.length == 0) {
            //    layui.layer.msg('没有符合条件的数据...');
            //    return;
            //}

            $('#prod').empty().append(assembleHtml(prodArr));
            $('#dev').empty().append(assembleHtml(devArr));
        }

        /*
        @function     JsonSort 对json排序
        @param        json     用来排序的json
        @param        key      排序的键值
        */
        function JsonSort(json, key) {
            for (var j = 1, jl = json.length; j < jl; j++) {
                var temp = json[j],
                    val = temp[key],
                    i = j - 1;
                while (i >= 0 && json[i][key] > val) {
                    json[i + 1] = json[i];
                    i = i - 1;
                }
                json[i + 1] = temp;

            }
            return json;
        }

        tinylog.init({ path: 'http://tinylog.xuchanglong.cn/api/LogRecord/collect', id: 'links', logType: ['click', 'error', 'request'] });
    </script>
</body>
</html>